package com.heyqing.medium.day11;

/**
 * ClassName:MaxScoreSightseeingPair
 * Package:com.heyqing.medium.day11
 * Description:
 *
 * @Date:2024/10/13
 * @Author:Heyqing
 */
public class MaxScoreSightseeingPair {
        public int maxScoreSightseeingPair(int[] values) {
            int ans = 0, mx = values[0] + 0;//v[i] + i
            for (int j = 1; j < values.length; ++j) {
                ans = Math.max(ans, mx + values[j] - j); //v[i] + i + v[j] - j
                mx = Math.max(mx, values[j] + j);
            }
            return ans;
        }
}
